import request from 'utils/request'

interface GetAllRouteListOption {
  routeName: string
  dzcode: string
  pageSize: number
  timestamp: string
  pageIndex: number
}

// 公交线路列表
export function getAllRouteList ({ routeName, dzcode, pageSize, timestamp, pageIndex }: GetAllRouteListOption) {
  return request({
    url: '/bus/busAnalysis/getAllRouteList',
    method: 'GET',
    params: {
      routeName,
      dzcode,
      pageSize,
      timestamp,
      pageIndex
    }
  })
}

interface GetStationListOption {
  dzcode?: string
  routeId: string
  segmentId: string
}

// 线路详情
export function getRouteDetail ({ dzcode, routeId, segmentId }: GetStationListOption) {
  return request({
    url: '/bus/busAnalysis/getStationList',
    method: 'GET',
    params: {
      dzcode,
      routeId,
      segmentId
    }
  })
}

interface GetStationDetailOption {
  dzcode?: string
  stationId: string
}

// 站点详情
export function getStationDetail ({ dzcode, stationId }: GetStationDetailOption) {
  return request({
    url: '/bus/busAnalysis/getStationDetail',
    method: 'GET',
    params: {
      dzcode,
      stationId
    }
  })
}

// 公交线路-态势统计
export function getSituationStatistics () {
  return request({
    url: '/bus/busAnalysis/getSituationStatistics',
    method: 'GET'
  })
}

interface GetRealTimeBusListOption {
  routeId: string
}

// 公交线路-获取某条线路上的车辆
export function getRealTimeBusList ({ routeId }: GetRealTimeBusListOption) {
  return request({
    url: '/bus/busAnalysis/getRealTimeBusList',
    method: 'GET',
    params: {
      routeId
    }
  })
}

interface GetRealTimeBusDriverInfoOption {
  driver: string
}

// 公交线路-车辆的驾驶人信息
export function getRealTimeBusDriverInfo ({ driver }: GetRealTimeBusDriverInfoOption) {
  return request({
    url: '/bus/busAnalysis/getRealTimeBusDriverInfo',
    method: 'GET',
    params: {
      driver
    }
  })
}
